<%@ page contentType="text/html; charset=UTF-8" %>
<%@ page import="com.wlcorp.forcazamis.domain.system.Department" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="com.wlcorp.forcazamis.domain.system.Staff" %>
<%
	Department department = (Department)request.getAttribute("department");
	List staffList = (List)request.getAttribute("staffList");
%>
<html>
<head>
	<title>部门信息更新</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<meta http-equiv="Pragma" content="no-cache"><meta http-equiv="Cache-Control" content="no-cache"><meta http-equiv="Expires" content="0">
	<link href="${pageContext.request.contextPath}/css/css.css" rel=stylesheet>
	<link rel="stylesheet" href="${pageContext.request.contextPath}/css/button_css.css" type="text/css">
	<link rel="stylesheet" href="${pageContext.request.contextPath}/css/form_css.css" type="text/css">
	<link rel="stylesheet" href="${pageContext.request.contextPath}/css/table_css.css" type="text/css">
	<link rel="stylesheet" href="${pageContext.request.contextPath}/css/pagetitle_css.css" type="text/css">
	<script language="javascript" src="${pageContext.request.contextPath}/script/validator.js"></script>
	<script type="text/javascript">
		function doSave(){
			if(!fieldIsNotEmpty(document.forms["departmentForm"].departmentName)){
				return;
			}
			if(!fieldIsNotEmpty(document.forms["departmentForm"].otherName)){
				return;
			}
			if(!fieldIsNotEmpty(document.forms["departmentForm"].departmentCode)){
				return;
			}
			document.forms["departmentForm"].submit();
		}
		function goback(){
			window.location = "${pageContext.request.contextPath}/system/departmentManager.do?method=getDepartmentList";
		}
	</script>
</head>
<body>
<form name="departmentForm" method="POST" action="${pageContext.request.contextPath}/system/departmentManager.do?method=modifyDepartment">
<input type="hidden" name="departmentId" value="${department.departmentId}"/>
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="30">
	<tr> 
	  <td width="22" class="page_titlebar_head">&nbsp;</td>
	  <td class="page_titlebar_bg" width="981">部门编辑</td>
	</tr>
</table>
<table width="60%" class="InputFrameMain" cellspacing="0" cellpadding="0" border="0" height="100" align="center">
  <tr class="InputFrameLine">
  		<td colspan="4" class="table_unfold_titlebar_small_bg">&nbsp;&nbsp;<b>部门基本信息编辑</b></td>
  </tr>
  <tr class="InputFrameLine">
        <td class="table_label" id="departmentName_TEXT">部门名称</td>
		<td>&nbsp;<input class="input" type="text" name="departmentName" value="${department.departmentName}" maxlength="20"/></td>
		<td class="table_label" id="managerId_TEXT">部门经理</td>
		<td>&nbsp;
			<select name="managerId" style="width:100">
				<option value="">--选择--</option>
				<%
					for(Iterator iter = staffList.iterator();iter.hasNext();){
						Staff staff = (Staff)iter.next();
				%>
				<option value="<%=staff.getStaffId()%>" <%if(null != department.getManager() && staff.getStaffId().equals(department.getManager().getStaffId())){out.print("selected");}%>><%=staff.getStaffName()%></option>
				<%}%>
			</select>
		</td>
  </tr>
  <tr class="InputFrameLine">
        <td class="table_label" id="otherName_TEXT">部门别称</td>
		<td>&nbsp;<input class="input" type="text" name="otherName" value="${department.otherName}" maxlength="20"/></td>
		<td class="table_label" id="departmentCode_TEXT">部门代码</td>
		<td>&nbsp;<input class="input" type="text" name="departmentCode" value="${department.departmentCode}" maxlength="20"/>
		</td>
  </tr>
  <tr class="InputFrameLine">
        <td class="table_label" id="flag_TEXT">特殊部门</td>
		<td>&nbsp;<select name="flag" style="width:100px">
			<option value="">非特殊部门</option>
			<option value="<%=com.wlcorp.forcazamis.sys.util.AppConstant.DEPART_FLAG_BUSINESS%>" <%if(null != department.getFlag() && com.wlcorp.forcazamis.sys.util.AppConstant.DEPART_FLAG_BUSINESS == department.getFlag().intValue()){out.print("selected");}%>>业务部</option>
			<option value="<%=com.wlcorp.forcazamis.sys.util.AppConstant.DEPART_FLAG_FINANCE%>" <%if(null != department.getFlag() && com.wlcorp.forcazamis.sys.util.AppConstant.DEPART_FLAG_FINANCE == department.getFlag().intValue()){out.print("selected");}%>>财务部</option>
		</select></td>
  </tr>
  <tr class="InputFrameLine">
        <td class="table_label" id="memo_TEXT">部门描述</td>
		<td colspan="3">&nbsp;<textarea id="memo" name="memo" cols="60" rows="5">${department.memo}</textarea></td>
  </tr>
  <tr class="InputFrameLine">
  	<td align="center" colspan="4"><input type="button" class="button_save" name="save_button" value="     保存" onclick="javascript:doSave()">
  	<input type="button" class="button_common_3" name="goback_button" value="返回" onclick="javascript:history.go(-1)" class="button_save"></td>
  </tr>
</table>
</form>
${message}
</body>
</html>
